<?php
session_start();
date_default_timezone_set("America/Sao_Paulo");
setlocale(LC_ALL, 'pt_BR');
include "../../../config/conexao.php";
include "../../../biblioteca/funcao.php";
extract($_GET);

if ($order == ""){ $order = "cliente.cli_code";}
?>
<html>
    
    <head>
        
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <link rel="stylesheet" type="text/css" href="../../../plugin/estilo.css">
        <link rel="stylesheet" type="text/css" href="../../../plugin/bootstrap/css/bootstrap-responsive.css">
        <link rel="stylesheet" type="text/css" href="../../../plugin/bootstrap/css/bootstrap.css"> 
        <script type="text/javascript" src="../../../plugin/jquery-1.7.2.js"></script>
        <script type="text/javascript" src="../../../plugin/bootstrap/js/bootstrap.min.js"></script>
        <script type="text/javascript" src="../../../plugin/funcao.js" /></script>

        <title>Imprimir</title>
        <link href="../../../base/favicon.ico" rel="shortcut icon" type="image/x-icon" />
        <!-- Le HTML5 shim, for IE6-8 support of HTML5 elements -->
            <!--[if lt IE 9]>
            <script src="plugin/html5.js"></script>
        <![endif]-->
        
    </head>
    
    <body>
        
        
        <div style="padding: 20px;">
            
            <h4>Listagem de Manning</h4>
            <br>
            <p class="pull-right"><a href="#" onclick="window.print();"><i class="icon-print"></i> Imprimir</a></p>
            <br>
            
            <table class="table table-striped table-bordered table-hover">

                <tr>
                    <th width="60"><i class="icon-chevron-down"></i> <a href='?order=cliente.cli_code' target="">CODE</a></th>
                    <th width="200"><i class="icon-chevron-down"></i> <a href='?order=cliente.cli_ramo' target=""><?=$t_ramo;?></a></th>
                    <th width="200"><i class="icon-chevron-down"></i> <a href='?order=cliente.cli_funcao' target=""><?=$t_fun;?></a></th>
                    <th width="100"><i class="icon-chevron-down"></i> <a href='?order=cliente.pai_id' target=""><?=$t_pais;?></a></th>
                    <th width="60"><i class="icon-chevron-down"></i> <a href='?order=cliente.pos_id' target=""><?=$t_posto;?></a></th>
                    <th width="200"><i class="icon-chevron-down"></i> <a href='?order=cliente.cli_guerra' target=""><?=$t_nomegue;?></a></th>
                    <th><i class="icon-chevron-down"></i> <a href='?order=cliente.cli_nome' target=""><?=$t_nomecompleto;?></a></th>
                </tr>

                    <?php

                    $sql = "SELECT cliente.cli_id,
                    cliente.cli_code,
                    cliente.cli_rtc,
                    cliente.cli_guerra,
                    cliente.cli_nome,
                    cliente.cli_ramal,
                    cliente.cli_tf3,
                    cliente.cli_tf4,
                    cliente.cli_siscomis,
                    cliente.cli_rtc,
                    cliente.cli_email,
                    posto.pos_nome,
                    posto.pos_nome2,
                    local.loc_nome,
                    local.loc_id2,
                    cliente.cli_ramo,
                    cliente.cli_funcao,
                    pais.pai_nome,
                    om.om_nome 
                    FROM cliente 
                    LEFT JOIN posto ON cliente.pos_id=posto.pos_id 
                    LEFT JOIN om ON om.om_id=cliente.om_id 
                    LEFT JOIN local ON local.loc_id=cliente.loc_id 
                    LEFT JOIN cliente_grupo ON cliente.cli_id=cliente_grupo.cli_id
                    LEFT JOIN pais ON cliente.pai_id=pais.pai_id
                    WHERE cliente.status='1' AND cliente.cli_id<>'1' $onde 
                    ORDER BY $order";  
                    $res = sql($sql);

                    $a = 0;       
                    while($linha = mysql_fetch_array($res)) {

                    ?>
                    <tr>
                    <td align="center"><?=$linha['cli_code'];?></td>
                    <td><?=$linha['cli_ramo'];?>&nbsp;</td>
                    <td><?=$linha['cli_funcao'];?>&nbsp;</td>
                    <td><?=$linha['pai_nome'];?></td>
                    <td><?=$linha['pos_nome2'];?>&nbsp;</td>
                    <td><?=$linha['cli_guerra'];?>&nbsp;</td>
                    <td><?=$linha['cli_nome'];?>&nbsp;</td>
                </tr>

                <?php
                    $a++;
                }
                ?>

            </table>

        </div>
        
    </body>
    
</html>